<html>
<head>
<title>Welcome to Yitai</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css" media="all">
  @import url("<?=base_url()?>css/yitai.css");
</style>

<script src="<?=base_url()?>js/jquery.min.js" type="text/javascript"></script>
<script src="<?=base_url()?>js/msgbox.js" type="text/javascript"></script>     
<script src="<?=base_url()?>js/yitai.js" type="text/javascript"></script>
</head>
<body>

  <!-- Header -->
<div id="wrapper">
     <div class="top">
     <div class="left">
       欢迎您，<?php
                  $CI = &get_instance();
                  echo $CI->session->userdata("username");
                  ?>
     </div>
     <div class="right">
       <img src="<?=base_url()?>images/top-bar.jpg" height="100">
     </div>
     </div>
  <div id="sidebar">
<?php
     $out = array();

$curr_link = current_link();

$menus = array(
    "安防信息查看",
    array(
        "manage/status_index, 家庭安全状态查看",
        "manage/defense_index, 布防控制"
        ),
    "更改安防信息",
    array(
        "manage/mod_user, 修改信息",
        "manage/logout, 注销登录"
        ),
    "用户管理",
    array(
        "manage/add_user, 增加用户",
        "manage/add_dev, 绑定设备"
        ));

while($val = current($menus)){
    
    $mid = key($menus);
    $out[] = "<div class='menu' id='menu_$mid' onclick=foldit('$mid')>".$val."</div>";
    $out[] = "<ul class='submenu' id='submenu_$mid'>";
    
    $val = next($menus);
    foreach($val as $li){
        list($link, $text) = explode(",", $li);
        if($link == $curr_link){
            $out[] = "<li class='selected-menu'>$text</li>";
        }else{
            $out[] = "<li><a href=\"".site_url($link)."\">$text</a></li>";
        }
    }
    
    $out[] = "</ul>";

    next($menus);
}

echo implode("\n", $out);

?>
  </div> <!-- sidebar -->

  <div id="content">
     
